import QtQuick 1.0

/**
 * You can use Component.onCompleted and Component.onDestroy to do some pre and post-processing
 */

Rectangle {
	width: 300
	height: 300

	PersistentObject {
		id: simpleObject
		property int counter

		Component.onCompleted: {
			counter++; // Increase counter *after* loading.
		}

		Component.onDestruction: {
			counter = 1000; // Has no effect, as the object is already saved
		}
	}

	TextInput {
		text: simpleObject.counter
	}
}
